package com.ruoyi.complex.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.complex.mapper.ComplexDirectoryMapper;
import com.ruoyi.complex.domain.ComplexDirectory;
import com.ruoyi.complex.service.IComplexDirectoryService;

/**
 * 综测目录Service业务层处理
 * 
 * @author wky
 * @date 2024-04-25
 */
@Service
public class ComplexDirectoryServiceImpl implements IComplexDirectoryService {
    @Autowired
    private ComplexDirectoryMapper complexDirectoryMapper;

    /**
     * 查询综测目录
     * 
     * @param directoryId 综测目录主键
     * @return 综测目录
     */
    @Override
    public ComplexDirectory selectComplexDirectoryByDirectoryId(Long directoryId) {
        return complexDirectoryMapper.selectComplexDirectoryByDirectoryId(directoryId);
    }

    /**
     * 查询综测目录列表
     * 
     * @param complexDirectory 综测目录
     * @return 综测目录
     */
    @Override
    public List<ComplexDirectory> selectComplexDirectoryList(ComplexDirectory complexDirectory) {
        return complexDirectoryMapper.selectComplexDirectoryList(complexDirectory);
    }

    /**
     * 新增综测目录
     * 
     * @param complexDirectory 综测目录
     * @return 结果
     */
    @Override
    public int insertComplexDirectory(ComplexDirectory complexDirectory) {
        complexDirectory.setCreateTime(DateUtils.getNowDate());
        return complexDirectoryMapper.insertComplexDirectory(complexDirectory);
    }

    /**
     * 修改综测目录
     * 
     * @param complexDirectory 综测目录
     * @return 结果
     */
    @Override
    public int updateComplexDirectory(ComplexDirectory complexDirectory) {
        complexDirectory.setUpdateTime(DateUtils.getNowDate());
        return complexDirectoryMapper.updateComplexDirectory(complexDirectory);
    }

    /**
     * 批量删除综测目录
     * 
     * @param directoryIds 需要删除的综测目录主键
     * @return 结果
     */
    @Override
    public int deleteComplexDirectoryByDirectoryIds(Long[] directoryIds) {
        return complexDirectoryMapper.deleteComplexDirectoryByDirectoryIds(directoryIds);
    }

    /**
     * 删除综测目录信息
     * 
     * @param directoryId 综测目录主键
     * @return 结果
     */
    @Override
    public int deleteComplexDirectoryByDirectoryId(Long directoryId) {
        return complexDirectoryMapper.deleteComplexDirectoryByDirectoryId(directoryId);
    }

    public int updateByAncestorName(ComplexDirectory complexDirectory) {
        return complexDirectoryMapper.updateByAncestorName(complexDirectory);
    }

    public int deleteByAncestorName(String ancestorName) {
        return complexDirectoryMapper.deleteByAncestorName(ancestorName);
    }
}
